<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        img {
            position: absolute;
            left: 0;
            top: 50px;
        }

        #demo {
            width: 1000px;
            margin: 0 132px;
        }
    </style>
    <script src="../../js/jquery.js"></script>
</head>

<body>
    <img src="images/aside.jpg" alt="" id="pic" />
    <div id="demo">
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
        <p>天王盖地虎，小鸡炖蘑菇</p>
    </div>
</body>

</html>

<script>
    $.fn.extend({
        move(){
            $(document).on("scroll",function(){
                let $scroll=$(document).scrollTop()
                console.log($scroll);
                let $top=$("#pic").offset().top
                console.log($top);
                if($scroll>=$top){
                    $("#pic").stop().animate({
                        top:$scroll+50
                    })
                }
                if($scroll<$top){
                    $("#pic").stop().animate({
                        top:$scroll+50
                    })
                }
            })
        }
    })

    $(function(){
        $("#pic").move()
    })
</script>